package gov.tax.rti.base.security.service.impl;

import gov.tax.rti.base.security.dao.impl.YhbsJdbcImpl;
import gov.tax.rti.core.model.RtiSqlCommand;
import gov.tax.rti.core.security.dao.DeptDao;
import gov.tax.rti.core.security.entity.Dept;
import gov.tax.rti.core.security.entity.User;
import gov.tax.rti.core.security.service.SecurityService;

import java.util.List;
import java.util.Map;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

@Service
public class YhbsServiceImpl {
	
	@Resource
	private YhbsJdbcImpl userDao;
	
	@Resource
	private DeptDao deptDao;

	@Resource
	private SecurityService securityService;
	
	public List<User> getYhbsBySjbqDm(String sjbqDm) {
		return userDao.getUsetByDept(sjbqDm);
	}
	
	public Dept getUserDataTagByLoginName(String loginName) throws Exception {
		User user = userDao.getUserByLoginName(loginName);
		return deptDao.getDeptByUserId(user.getId());
	}

	public List<Map<String, Object>> getNSr(int dataSize,String filterValue) throws Exception {
		RtiSqlCommand rtiSqlCommand = securityService.getSecDataTagSql(false);
		return userDao.getNSr(dataSize, rtiSqlCommand, filterValue);
	}
	
	public User getUserById(String id) throws Exception {
		return userDao.getUserById(id);
	}

}
